<!DOCTYPE html>
<html>
	<head>
	    <title>菜单分配</title>
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <!-- 所有的 css 资源 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> 
		<link rel="stylesheet" href="../../static/sa.css"> 
		<!-- 所有的 js 资源 -->
		<script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
		<script src="https://unpkg.com/element-ui@2.8.2/lib/index.js"></script>
		<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
		<script src="https://cdn.bootcss.com/layer/3.0.1/layer.min.js"></script>
		<script src="../../static/sa.js"></script>
        <style>
			body,.el-tree{
				background-color: #F5F5F5;
			}
			.el-tree-node{margin: 0.15em 0 !important;}
			/* 悬浮时颜色更深一点 */
			.el-tree-node__content:hover{background-color: #CFE8FC !important;}
        </style>
	</head>
	<body>
		<div class="vue-box">
			<!-- 表格 -->
			<div style="padding: 2em;">
				<div class="c-title">菜单预览</div>
		        <!-- 树插件 -->
				<el-tree
					ref="tree"
					:data="dataList"
					node-key="id"
					:default-expand-all="true"
					>
					<span class="custom-tree-node" slot-scope="{ node, data }">
						<span style="color: #2D8CF0;" v-if="data.is_show == undefined || data.is_show == true">{{ data.name }}</span>
						<span style="color: #999;" v-if="data.is_show == false">{{ data.name }} (隐藏)</span>
						<span style="color: #999;" v-if="data.info">&emsp;———— {{data.info}} </span>
					</span>
				</el-tree>
			</div>
		</div>
		<script src="../../sa-resources/menu-list.js"></script>
		<script src="../../sa-resources/admin-util.js"></script>
        <script>
			var role_id = sa.$util.getUrlArgs('role_id');
			var app = new Vue({
				el: '.vue-box',
				data: {
					dataList: [],	// 数据集合 
				},
				created: function(){
					// 全部
					sa.ajax2('/SysMenu/getList', this.p, function(res){
						menuList = arrayToTree(menuList);	// 一维转tree 
						menuList = refMenuList(menuList);	// 属性处理 
						this.dataList = menuList;	// 数据  
					}.bind(this));
				}
			})
		</script>
	</body>
</html>